import 'package:flutter/material.dart';
import 'package:shudu/utils/global.dart';

typedef OperateBlock = Function(int index);

class OperateWidget extends StatelessWidget {
  final OperateBlock block;

  OperateWidget({required this.block});

  @override
  Widget build(BuildContext context) {
    return AspectRatio(
      aspectRatio: 1,
      child: Container(
        decoration:
            BoxDecoration(color: const Color(0xFFF5F5F5).withOpacity(0.9)),
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            GestureDetector(
              onTap: () {
                block(1);
              },
              child: Container(
                width: 264,
                height: 52,
                alignment: Alignment.center,
                decoration: BoxDecoration(
                    color: mainColor, borderRadius: BorderRadius.circular(12)),
                child: const Text(
                  "继续游戏",
                  style: TextStyle(
                      color: Colors.white, fontSize: 16),
                ),
              ),
            ),
            const SizedBox(
              height: 20,
            ),
            GestureDetector(
              onTap: () {
                block(2);
              },
              child: Container(
                width: 264,
                height: 52,
                alignment: Alignment.center,
                decoration: BoxDecoration(
                    border: Border.all(color: mainColor, width: 2),
                    borderRadius: BorderRadius.circular(12)),
                child: const Text(
                  "重来本局",
                  style: TextStyle(
                      color: mainColor, fontSize: 16,),
                ),
              ),
            ),
            const SizedBox(
              height: 20,
            ),
            GestureDetector(
              onTap: () {
                block(3);
              },
              child: Container(
                width: 264,
                height: 52,
                alignment: Alignment.center,
                decoration: BoxDecoration(
                    border: Border.all(color: mainColor, width: 2),
                    borderRadius: BorderRadius.circular(12)),
                child: const Text(
                  "返回首页",
                  style: TextStyle(
                      color: mainColor, fontSize: 16,),
                ),
              ),
            )
          ],
        ),
      ),
    );
  }
}
